package com.ssy.lingxi.marketing.serviceimpl.component.activity;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.ssy.lingxi.common.constant.marketing.ActivityTypeEnum;
import com.ssy.lingxi.common.constant.marketing.BelongTypeEnum;
import com.ssy.lingxi.common.utils.DateTimeUtil;
import com.ssy.lingxi.marketing.entity.activity.ActivityGoodsSubsidiaryDO;
import com.ssy.lingxi.marketing.model.bo.*;
import com.ssy.lingxi.marketing.model.constant.*;
import com.ssy.lingxi.marketing.repository.ActivityGoodsSubsidiaryRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 活动标签组件
 * @author yzc
 * @version 2.0.0
 * @date 2021/11/23
 */
@Slf4j
@Component
public class ActivityTagComponent implements ActivityStrPool {

    @Resource
    private ActivityGoodsSubsidiaryRepository goodsSubsidiaryRepository;
    @Resource
    private ActivityGoodsHandleComponent goodsHandleComponent;

    /**
     * @see #handActivityGoodsTag
     * @param activityGoodsBOList 接口参数
     * @return 返回结果
     */
    public List<ActivityGoodsTagBO> handActivityGoodsTag(List<ActivityGoodsDetailBO> activityGoodsBOList) {
        return activityGoodsBOList.stream().map(this::handActivityGoodsTag).collect(Collectors.toList());
    }

    /**
     * 处理各种类型的活动标签
     * @param activityGoodsBO 接口参数
     * @return 返回结果
     */
    public ActivityGoodsTagBO handActivityGoodsTag(ActivityGoodsDetailBO activityGoodsBO) {
        // 活动类型
        Integer activityType = activityGoodsBO.getActivityBO().getActivityType();
        // 组装数据
        ActivityGoodsTagBO activityGoodsTagBO = new ActivityGoodsTagBO();
        if (ActivityTypeEnum.SPECIAL_OFFER.getCode().equals(activityType)) {
            // 特价促销
            activityGoodsTagBO = this.specialOfferTag(activityGoodsBO);
        } else if (ActivityTypeEnum.PLUMMET.getCode().equals(activityType)) {
            // 直降促销
            activityGoodsTagBO = this.plummetTag(activityGoodsBO);
        } else if (ActivityTypeEnum.DISCOUNT.getCode().equals(activityType)) {
            // 折扣促销
            activityGoodsTagBO = this.discountTag(activityGoodsBO);
        } else if (ActivityTypeEnum.FULL_QUANTITY.getCode().equals(activityType)) {
            // 满量促销
            activityGoodsTagBO = this.fullQuantityTag(activityGoodsBO);
        } else if (ActivityTypeEnum.FULL_MONEY.getCode().equals(activityType)) {
            // 满额促销
            activityGoodsTagBO = this.fullMoneyTag(activityGoodsBO);
        } else if (ActivityTypeEnum.GIVE.getCode().equals(activityType)) {
            // 赠送促销
            activityGoodsTagBO = this.giveTag(activityGoodsBO);
        } else if (ActivityTypeEnum.MORE_PIECE.getCode().equals(activityType)) {
            // 多件促销
            activityGoodsTagBO = this.morePieceTag(activityGoodsBO);
        } else if (ActivityTypeEnum.COMBINATION.getCode().equals(activityType)) {
            // 组合促销
            activityGoodsTagBO = this.combinationTag(activityGoodsBO);
        } else if (ActivityTypeEnum.GROUP_PURCHASE.getCode().equals(activityType)) {
            // 拼团
            activityGoodsTagBO = this.groupPurchaseTag(activityGoodsBO);
        } else if (ActivityTypeEnum.LOTTERY.getCode().equals(activityType)) {
            // 抽奖 ignore
        } else if (ActivityTypeEnum.BARGAIN.getCode().equals(activityType)) {
            // 砍价
            activityGoodsTagBO = this.bargainTag(activityGoodsBO);
        } else if (ActivityTypeEnum.SEC_KILL.getCode().equals(activityType)) {
            // 秒杀
            activityGoodsTagBO = this.secKillTag(activityGoodsBO);
        } else if (ActivityTypeEnum.SWAP.getCode().equals(activityType)) {
            // 换购
            activityGoodsTagBO = this.swapTag(activityGoodsBO);
        } else if (ActivityTypeEnum.PRE_SALE.getCode().equals(activityType)) {
            // 预售
            activityGoodsTagBO = this.preSaleTag(activityGoodsBO);
        } else if (ActivityTypeEnum.SET_MEAL.getCode().equals(activityType)) {
            // 套餐
            activityGoodsTagBO = this.setMealTag(activityGoodsBO);
        } else if (ActivityTypeEnum.ATTEMPT.getCode().equals(activityType)) {
            // 试用
            activityGoodsTagBO = this.attemptTag(activityGoodsBO);
        }
        activityGoodsTagBO.setActivityGoodsId(activityGoodsBO.getId());
        return activityGoodsTagBO;
    }

    /**
     * 处理活动的描述
     * @param activityBO 活动BO
     * @return 返回结果
     */
    public ActivityTagBO handActivityTag(ActivityBO activityBO) {
        Integer activityType = activityBO.getActivityType();
        ActivityTagBO activityTagBO = new ActivityTagBO();
        if (ActivityTypeEnum.SPECIAL_OFFER.getCode().equals(activityType)) {
            // 特价促销
            activityTagBO = this.specialOfferDesc(activityBO);
        } else if (ActivityTypeEnum.PLUMMET.getCode().equals(activityType)) {
            // 直降促销
            activityTagBO = this.plummetDesc(activityBO);
        } else if (ActivityTypeEnum.DISCOUNT.getCode().equals(activityType)) {
            // 折扣促销
            activityTagBO = this.discountDesc(activityBO);
        } else if (ActivityTypeEnum.FULL_QUANTITY.getCode().equals(activityType)) {
            // 满量促销
            activityTagBO = this.fullQuantityDesc(activityBO);
        } else if (ActivityTypeEnum.FULL_MONEY.getCode().equals(activityType)) {
            // 满额促销
            activityTagBO = this.fullMoneyDesc(activityBO);
        } else if (ActivityTypeEnum.GIVE.getCode().equals(activityType)) {
            // 赠送促销
            activityTagBO = this.giveDesc(activityBO);
        } else if (ActivityTypeEnum.MORE_PIECE.getCode().equals(activityType)) {
            // 多件促销
            activityTagBO = this.morePieceDesc(activityBO);
        } else if (ActivityTypeEnum.COMBINATION.getCode().equals(activityType)) {
            // 组合促销
            activityTagBO = this.combinationDesc(activityBO);
        } else if (ActivityTypeEnum.GROUP_PURCHASE.getCode().equals(activityType)) {
            // 拼团
            activityTagBO = this.groupPurchaseDesc(activityBO);
        } else if (ActivityTypeEnum.LOTTERY.getCode().equals(activityType)) {
            // 抽奖 ignore
        } else if (ActivityTypeEnum.BARGAIN.getCode().equals(activityType)) {
            // 砍价
            activityTagBO = this.bargainDesc(activityBO);
        } else if (ActivityTypeEnum.SEC_KILL.getCode().equals(activityType)) {
            // 秒杀
            activityTagBO = this.secKillDesc(activityBO);
        } else if (ActivityTypeEnum.SWAP.getCode().equals(activityType)) {
            // 换购
            activityTagBO = this.swapDesc(activityBO);
        } else if (ActivityTypeEnum.PRE_SALE.getCode().equals(activityType)) {
            // 预售
            activityTagBO = this.preSaleDesc(activityBO);
        } else if (ActivityTypeEnum.SET_MEAL.getCode().equals(activityType)) {
            // 套餐
            activityTagBO = this.setMealDesc(activityBO);
        } else if (ActivityTypeEnum.ATTEMPT.getCode().equals(activityType)) {
            // 试用
            activityTagBO = this.attemptDesc(activityBO);
        }

        return activityTagBO;
    }

    // ========================活动标签========================

    /**
     * 特价
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO specialOfferTag(ActivityGoodsDetailBO activityGoodsBO) {
        Long endTime = activityGoodsBO.getActivityBO().getEndTime();

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.specialOffer_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.specialOffer_pt.getMessage());
        ActivityGoodsTagBO.setPreferentialTagDesc(strFormat(ActivityStrPoolEnum.specialOffer_ptd.getMessage(), millisecondToDateStr(endTime)));

        return ActivityGoodsTagBO;
    }

    /**
     * 直降
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO plummetTag(ActivityGoodsDetailBO activityGoodsBO) {
        Long endTime = activityGoodsBO.getActivityBO().getEndTime();

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.plummet_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.plummet_pt.getMessage());
        ActivityGoodsTagBO.setPreferentialTagDesc(strFormat(ActivityStrPoolEnum.plummet_ptd.getMessage(), millisecondToDateStr(endTime)));
        return ActivityGoodsTagBO;
    }

    /**
     * 折扣
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO discountTag(ActivityGoodsDetailBO activityGoodsBO) {
        Long endTime = activityGoodsBO.getActivityBO().getEndTime();

        BigDecimal discountNum = hundredToTen(activityGoodsBO.getDiscount());
        String discountNumStr = decimalFormatStr(discountNum);

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(strFormat(ActivityStrPoolEnum.discount_at.getMessage(), discountNumStr));
        ActivityGoodsTagBO.setPreferentialTag(strFormat(ActivityStrPoolEnum.discount_pt.getMessage(), discountNumStr));
        ActivityGoodsTagBO.setPreferentialTagDesc(strFormat(ActivityStrPoolEnum.discount_ptd.getMessage(), millisecondToDateStr(endTime)));

        return ActivityGoodsTagBO;
    }

    /**
     * 满量
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO fullQuantityTag(ActivityGoodsDetailBO activityGoodsBO) {
        FullQuantityBO fullQuantityBO = (FullQuantityBO) activityGoodsBO.getActivityBO().getActivityDefined();
        Integer belongType = activityGoodsBO.getBelongType();

        if (BelongTypeEnum.PLATFORM.getCode().equals(belongType)) {
            if (FullQuantityTypeEnum.REDUCTION.getCode().equals(fullQuantityBO.getType())) {
                return this.fullQuantityPfReductionTag(activityGoodsBO, fullQuantityBO);
            } else if (FullQuantityTypeEnum.DISCOUNT.getCode().equals(fullQuantityBO.getType())) {
                return this.fullQuantityPfDiscountTag(activityGoodsBO, fullQuantityBO);
            }
        } else if (BelongTypeEnum.MERCHANT.getCode().equals(belongType)) {
            if (FullQuantityTypeEnum.REDUCTION.getCode().equals(fullQuantityBO.getType())) {
                return this.fullQuantityMcReductionTag(activityGoodsBO, fullQuantityBO);
            } else if (FullQuantityTypeEnum.DISCOUNT.getCode().equals(fullQuantityBO.getType())) {
                return this.fullQuantityMcDiscountTag(activityGoodsBO, fullQuantityBO);
            }
        }

        return null;
    }

    /**
     * 满额
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO fullMoneyTag(ActivityGoodsDetailBO activityGoodsBO) {
        FullMoneyBO fullMoneyBO = (FullMoneyBO) activityGoodsBO.getActivityBO().getActivityDefined();
        Integer belongType = activityGoodsBO.getBelongType();

        if (BelongTypeEnum.PLATFORM.getCode().equals(belongType)) {
            if (FullMoneyTypeEnum.REDUCTION.getCode().equals(fullMoneyBO.getType())) {
                return this.fullMoneyPfReductionTag(activityGoodsBO, fullMoneyBO);

            } else if (FullMoneyTypeEnum.DISCOUNT.getCode().equals(fullMoneyBO.getType())) {
                return this.fullMoneyPfDiscountTag(activityGoodsBO, fullMoneyBO);
            }

        } else if (BelongTypeEnum.MERCHANT.getCode().equals(belongType)) {
            if (FullMoneyTypeEnum.REDUCTION.getCode().equals(fullMoneyBO.getType())) {
                return this.fullMoneyMcReductionTag(activityGoodsBO, fullMoneyBO);

            } else if (FullMoneyTypeEnum.DISCOUNT.getCode().equals(fullMoneyBO.getType())) {
                return this.fullMoneyMcDiscountTag(activityGoodsBO, fullMoneyBO);
            }
        }

        return null;
    }

    /**
     * 赠送
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO giveTag(ActivityGoodsDetailBO activityGoodsBO) {
        GiveBO giveBO = (GiveBO) activityGoodsBO.getActivityBO().getActivityDefined();

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        if (GiveTypeEnum.FULL_MONEY.getCode().equals(giveBO.getGiveType())) {

            if (GiveGiftTypeEnum.GOODS.getCode().equals(giveBO.getGiftType())) {
                return this.giveFullMoneyGoodsTag(activityGoodsBO, giveBO);

            } else if (GiveGiftTypeEnum.COUPON.getCode().equals(giveBO.getGiftType())) {
                return this.giveFullMoneyCouponTag(activityGoodsBO, giveBO);

            }

        } else if (GiveTypeEnum.BUY_GOODS.getCode().equals(giveBO.getGiveType())) {

            if (GiveGiftTypeEnum.GOODS.getCode().equals(giveBO.getGiftType())) {
                return this.giveBuyGoodsGoodsTag(activityGoodsBO, giveBO);

            } else if (GiveGiftTypeEnum.COUPON.getCode().equals(giveBO.getGiftType())) {
                return this.giveBuyGoodsCouponTag(activityGoodsBO, giveBO);

            }

        }

        return ActivityGoodsTagBO;
    }

    /**
     * 多件
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO morePieceTag(ActivityGoodsDetailBO activityGoodsBO) {
        MorePieceBO morePieceBO = (MorePieceBO) activityGoodsBO.getActivityBO().getActivityDefined();
        MorePieceBO.LadderBO minLadderBO = morePieceBO.getLadderList().stream().min(Comparator.comparing(MorePieceBO.LadderBO::getDiscount)).orElse(null);
        BigDecimal minDiscountNum = BigDecimal.ZERO;
        BigDecimal minNum = BigDecimal.ZERO;
        if (Objects.nonNull(minLadderBO)) {
            minDiscountNum = hundredToTen(minLadderBO.getDiscount());
            minNum = minLadderBO.getNum();
        }

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(strFormat(ActivityStrPoolEnum.morePiece_at.getMessage(), decimalFormatStr(minNum), decimalFormatStr(minDiscountNum)));
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.morePiece_pt.getMessage());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.morePieceLadderTag(morePieceBO);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(morePieceBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    /**
     * 组合
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO combinationTag(ActivityGoodsDetailBO activityGoodsBO) {
        CombinationBO combinationBO = (CombinationBO) activityGoodsBO.getActivityBO().getActivityDefined();

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());

        String numStr = decimalFormatStr(combinationBO.getPrice());
        ActivityGoodsTagBO.setActivityTypeTag(strFormat(ActivityStrPoolEnum.combination_at.getMessage(), numStr));
        ActivityGoodsTagBO.setPreferentialTag(strFormat(ActivityStrPoolEnum.combination_pt.getMessage(), numStr));

        ActivityGoodsTagBO.setPreferentialTagDesc(strFormat(ActivityStrPoolEnum.combination_ptd.getMessage(), decimalFormatStr(combinationBO.getPrice()), combinationBO.getNum()));

        return ActivityGoodsTagBO;
    }

    /**
     * 拼团
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO groupPurchaseTag(ActivityGoodsDetailBO activityGoodsBO) {
        GroupPurchaseBO groupPurchaseBO = (GroupPurchaseBO) activityGoodsBO.getActivityBO().getActivityDefined();
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.groupPurchase_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.groupPurchase_pt.getMessage());
        ActivityGoodsTagBO.setPreferentialTagDesc(strFormat(ActivityStrPoolEnum.groupPurchase_ptd.getMessage(),groupPurchaseBO.getAssembleNum()));
        return ActivityGoodsTagBO;
    }

    /**
     * 砍价
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO bargainTag(ActivityGoodsDetailBO activityGoodsBO) {

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.bargain_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.bargain_pt.getMessage());
        ActivityGoodsTagBO.setPreferentialTagDesc("");
        return ActivityGoodsTagBO;
    }

    private String getLastKillStartTime(Long killStartTime,Long killEndTime){
        Calendar instance = Calendar.getInstance();
        DateTime dateTime=new DateTime();
        boolean belongPeriodOfNow = DateTimeUtil.isBelongPeriodOfNow(killStartTime, killEndTime);
        if(!belongPeriodOfNow){
            int nowSecOfHHmmss = DateTimeUtil.getNowSecOfHHmmss();
            int endSec = DateTimeUtil.getNowSecOfHHmmss(killStartTime);
            if(nowSecOfHHmmss>endSec){
                dateTime = DateUtil.offsetDay(instance.getTime(), 1);
            }
        }
        Long nextDay = DateTimeUtil.copyHHmmss(dateTime.getTime(), killStartTime);
        dateTime.setTime(nextDay);
        return formatSecKillDate(dateTime.getTime());
    }

    /**
     * 获得不同语言的格式化日期
     * @param secKillStartPeriod
     * @return feb 2 15:15 /2月2号 15:15 /2월 02 15:15
     */
    private String formatSecKillDate(Long secKillStartPeriod){
        Date date=new Date();
        date.setTime(secKillStartPeriod);
        String df="%tb %td %tR";
        Locale locale = LocaleContextHolder.getLocale();
        if(locale.getLanguage().equals("zh")){
            df="%tm月%td日 %tR";
        }
        return String.format(locale,df,date,date,date);
    }

    /**
     * 秒杀
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO secKillTag(ActivityGoodsDetailBO activityGoodsBO) {
        Long endTime = activityGoodsBO.getActivityBO().getEndTime();

        SecKillBO secKillBO=(SecKillBO)activityGoodsBO.getActivityBO().getActivityDefined();
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(secKillBO);
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.secKill_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.secKill_pt.getMessage());
        //
        ActivityGoodsTagBO.setPreferentialTagDesc(strFormat(ActivityStrPoolEnum.secKill_ptd2.getMessage(), getLastKillStartTime(secKillBO.getStartTime(),secKillBO.getEndTime())));

        return ActivityGoodsTagBO;
    }

    /**
     * 换购
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO swapTag(ActivityGoodsDetailBO activityGoodsBO) {
        SwapBO swapBO = (SwapBO) activityGoodsBO.getActivityBO().getActivityDefined();

        if (SwapTypeEnum.FULL_MONEY.getCode().equals(swapBO.getSwapType())) {
            return this.swapFullMoneyTag(activityGoodsBO, swapBO);
        } else if (SwapTypeEnum.BUY_GOODS.getCode().equals(swapBO.getSwapType())) {
            return this.swapBuyGoodsTag(activityGoodsBO, swapBO);
        }

        return null;
    }

    /**
     * 预售
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO preSaleTag(ActivityGoodsDetailBO activityGoodsBO) {

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.pre_sell_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.pre_sell_pt.getMessage());
        ActivityGoodsTagBO.setPreferentialTagDesc("");

        return ActivityGoodsTagBO;
    }

    /**
     * 套餐
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO setMealTag(ActivityGoodsDetailBO activityGoodsBO) {

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.setMeal_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.setMeal_pt.getMessage());
        ActivityGoodsTagBO.setPreferentialTagDesc("");

        return ActivityGoodsTagBO;
    }

    /**
     * 试用
     *
     * @param activityGoodsBO 活动商品
     * @return 返回结果
     */
    private ActivityGoodsTagBO attemptTag(ActivityGoodsDetailBO activityGoodsBO) {

        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.attempt_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.attempt_pt.getMessage());
        ActivityGoodsTagBO.setPreferentialTagDesc("");

        return ActivityGoodsTagBO;
    }

    // ========================活动细分类型标签========================

    private ActivityGoodsTagBO fullQuantityPfReductionTag(ActivityGoodsDetailBO activityGoodsBO, FullQuantityBO fullQuantityBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.full_money_pt_reduction_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.full_money_pt_reduction_pt.getMessage());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullQuantityReductionLadderTag(fullQuantityBO);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(fullQuantityBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO fullQuantityPfDiscountTag(ActivityGoodsDetailBO activityGoodsBO, FullQuantityBO fullQuantityBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.full_money_pt_discount_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.full_money_pt_discount_pt.getMessage());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullQuantityDiscountLadderTag(fullQuantityBO);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(fullQuantityBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO fullQuantityMcReductionTag(ActivityGoodsDetailBO activityGoodsBO, FullQuantityBO fullQuantityBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.full_quantity_reduction_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.full_quantity_reduction_pt.getMessage());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullQuantityReductionLadderTag(fullQuantityBO);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(fullQuantityBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO fullQuantityMcDiscountTag(ActivityGoodsDetailBO activityGoodsBO, FullQuantityBO fullQuantityBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.full_quantity_discount_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.full_quantity_discount_pt.getMessage());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullQuantityDiscountLadderTag(fullQuantityBO);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(fullQuantityBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO fullMoneyPfReductionTag(ActivityGoodsDetailBO activityGoodsBO, FullMoneyBO fullMoneyBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.full_money_pt_reduction_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.full_money_pt_reduction_pt.getMessage());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullMoneyReductionLadderTag(fullMoneyBO);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(fullMoneyBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO fullMoneyMcReductionTag(ActivityGoodsDetailBO activityGoodsBO, FullMoneyBO fullMoneyBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.full_money_at_reduction_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.full_money_at_reduction_pt.getMessage());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullMoneyReductionLadderTag(fullMoneyBO);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(fullMoneyBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO fullMoneyPfDiscountTag(ActivityGoodsDetailBO activityGoodsBO, FullMoneyBO fullMoneyBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.full_money_pt_discount_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.full_money_pt_discount_pt.getMessage());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullMoneyDiscountLadderTag(fullMoneyBO);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(fullMoneyBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO fullMoneyMcDiscountTag(ActivityGoodsDetailBO activityGoodsBO, FullMoneyBO fullMoneyBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.full_money_at_discount_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.full_money_at_discount_pt.getMessage());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullMoneyDiscountLadderTag(fullMoneyBO);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(fullMoneyBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO giveFullMoneyGoodsTag(ActivityGoodsDetailBO activityGoodsBO, GiveBO giveBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.give_goods_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.give_goods_pt.getMessage());

        Map<Long, List<ActivityGoodsSubsidiaryGroupBO>> goodsSubsidiaryListMap = goodsHandleComponent.getActivityGoodsSubsidiaryListMap(Collections.singletonList(activityGoodsBO.getId()));
        List<ActivityGoodsSubsidiaryGroupBO> goodsSubsidiaryGroupRespList = goodsSubsidiaryListMap.getOrDefault(activityGoodsBO.getId(), Collections.emptyList());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.giveFullMoneyGoodsLadderTag(goodsSubsidiaryGroupRespList);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(giveBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO giveFullMoneyCouponTag(ActivityGoodsDetailBO activityGoodsBO, GiveBO giveBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.give_coupon_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.give_coupon_pt.getMessage());

        Map<Long, List<ActivityGoodsCouponGroupBO>> goodsCouponListMap = goodsHandleComponent.getActivityGoodsCouponListMap(Collections.singletonList(activityGoodsBO.getId()));
        List<ActivityGoodsCouponGroupBO> goodsCouponGroupRespList = goodsCouponListMap.getOrDefault(activityGoodsBO.getId(), Collections.emptyList());


        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.giveFullMoneyCouponLadderTag(goodsCouponGroupRespList);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(giveBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO giveBuyGoodsGoodsTag(ActivityGoodsDetailBO activityGoodsBO, GiveBO giveBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.give_goods_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.give_goods_pt.getMessage());

        Map<Long, List<ActivityGoodsSubsidiaryGroupBO>> goodsSubsidiaryListMap = goodsHandleComponent.getActivityGoodsSubsidiaryListMap(Collections.singletonList(activityGoodsBO.getId()));
        List<ActivityGoodsSubsidiaryGroupBO> goodsSubsidiaryGroupRespList = goodsSubsidiaryListMap.getOrDefault(activityGoodsBO.getId(), Collections.emptyList());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.giveBuyGoodsGoodsLadderTag(goodsSubsidiaryGroupRespList);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(giveBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO giveBuyGoodsCouponTag(ActivityGoodsDetailBO activityGoodsBO, GiveBO giveBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.give_coupon_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.give_coupon_pt.getMessage());

        Map<Long, List<ActivityGoodsCouponGroupBO>> goodsCouponListMap = goodsHandleComponent.getActivityGoodsCouponListMap(Collections.singletonList(activityGoodsBO.getId()));
        List<ActivityGoodsCouponGroupBO> goodsCouponGroupRespList = goodsCouponListMap.getOrDefault(activityGoodsBO.getId(), Collections.emptyList());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.giveBuyGoodsCouponLadderTag(goodsCouponGroupRespList);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(giveBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO swapFullMoneyTag(ActivityGoodsDetailBO activityGoodsBO, SwapBO swapBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.swap_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.swap_pt.getMessage());

        // 附属商品
        List<ActivityGoodsSubsidiaryDO> goodsSubList = goodsSubsidiaryRepository.findByActivityGoodsId(activityGoodsBO.getId());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.swapFullMoneyLadderTag(goodsSubList);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(swapBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    private ActivityGoodsTagBO swapBuyGoodsTag(ActivityGoodsDetailBO activityGoodsBO, SwapBO swapBO) {
        ActivityGoodsTagBO ActivityGoodsTagBO = new ActivityGoodsTagBO();
        ActivityGoodsTagBO.setActivityId(activityGoodsBO.getActivityBO().getActivityId());
        ActivityGoodsTagBO.setBelongType(activityGoodsBO.getBelongType());
        ActivityGoodsTagBO.setActivityType(activityGoodsBO.getActivityBO().getActivityType());
        ActivityGoodsTagBO.setActivityDefinedBO(activityGoodsBO.getActivityBO().getActivityDefined());
        ActivityGoodsTagBO.setStartTime(activityGoodsBO.getActivityBO().getStartTime());
        ActivityGoodsTagBO.setEndTime(activityGoodsBO.getActivityBO().getEndTime());
        ActivityGoodsTagBO.setActivityTypeTag(ActivityStrPoolEnum.swap_at.getMessage());
        ActivityGoodsTagBO.setPreferentialTag(ActivityStrPoolEnum.swap_pt.getMessage());

        // 附属商品
        List<ActivityGoodsSubsidiaryDO> goodsSubList = goodsSubsidiaryRepository.findByActivityGoodsId(activityGoodsBO.getId());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.swapBuyGoodsLadderTag(goodsSubList);
        ActivityGoodsTagBO.setPreferentialTagDesc(this.preferentialLadderToString(swapBO, preferentialLadders));
        ActivityGoodsTagBO.setPreferentialLadderList(preferentialLadders);

        return ActivityGoodsTagBO;
    }

    // ========================活动梯度标签========================

    private List<ActivityGoodsTagBO.PreferentialLadder> fullQuantityReductionLadderTag(FullQuantityBO fullQuantityBO) {
        return fullQuantityBO.getLadderList().stream().map(ladderBO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(ladderBO.getKey());
            preferentialLadder.setDesc(strFormat(ActivityStrPoolEnum.full_quantity_reduction_ptd.getMessage(), ladderBO.getKey(), ladderBO.getValue()));
            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> fullQuantityDiscountLadderTag(FullQuantityBO fullQuantityBO) {
        return fullQuantityBO.getLadderList().stream().map(ladderBO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(ladderBO.getKey());
            preferentialLadder.setDesc(strFormat(ActivityStrPoolEnum.full_quantity_discount_ptd.getMessage(), ladderBO.getKey(), hundredToTen(ladderBO.getValue()).stripTrailingZeros().toPlainString()));
            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> fullMoneyReductionLadderTag(FullMoneyBO fullMoneyBO) {
        return fullMoneyBO.getLadderList().stream().map(ladderBO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(ladderBO.getKey());
            preferentialLadder.setDesc(strFormat(ActivityStrPoolEnum.full_money_reduction_ptd.getMessage(), ladderBO.getKey(), ladderBO.getValue()));
            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> fullMoneyDiscountLadderTag(FullMoneyBO fullMoneyBO) {
        return fullMoneyBO.getLadderList().stream().map(ladderBO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(ladderBO.getKey());
            preferentialLadder.setDesc(strFormat(ActivityStrPoolEnum.full_money_discount_ptd.getMessage(), ladderBO.getKey(), decimalFormatStr(hundredToTen(ladderBO.getValue()))));
            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> morePieceLadderTag(MorePieceBO morePieceBO) {
        return morePieceBO.getLadderList().stream().map(ladderBO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(ladderBO.getNum());
            preferentialLadder.setDesc(strFormat(ActivityStrPoolEnum.morePiece_ptd.getMessage(), ladderBO.getNum(), decimalFormatStr(hundredToTen(ladderBO.getDiscount()))));
            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> swapFullMoneyLadderTag(List<ActivityGoodsSubsidiaryDO> goodsSubList) {
        return goodsSubList.stream().map(goodsSubsidiaryDO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(goodsSubsidiaryDO.getLimitValue());

            ActivityGoodsTagBO.Item item = new ActivityGoodsTagBO.Item();
            item.setNum(goodsSubsidiaryDO.getNum());
            item.setDesc(strFormat(ActivityStrPoolEnum.swap_full_money_ptd.getMessage(), decimalFormatStr(goodsSubsidiaryDO.getLimitValue()), goodsSubsidiaryDO.getProductName()));
            preferentialLadder.setItems(Collections.singletonList(item));

            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> swapBuyGoodsLadderTag(List<ActivityGoodsSubsidiaryDO> goodsSubList) {
        return goodsSubList.stream().map(goodsSubsidiaryDO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(goodsSubsidiaryDO.getLimitValue());

            ActivityGoodsTagBO.Item item = new ActivityGoodsTagBO.Item();
            item.setNum(goodsSubsidiaryDO.getNum());
            item.setDesc(strFormat(ActivityStrPoolEnum.swap_buy_goods_ptd.getMessage(), decimalFormatStr(goodsSubsidiaryDO.getLimitValue()), goodsSubsidiaryDO.getProductName()));
            preferentialLadder.setItems(Collections.singletonList(item));

            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> giveFullMoneyGoodsLadderTag(List<ActivityGoodsSubsidiaryGroupBO> goodsSubsidiaryGroupRespList) {
        return goodsSubsidiaryGroupRespList.stream().map(goodsSubsidiaryGroupBO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(goodsSubsidiaryGroupBO.getLimitValue());

            List<ActivityGoodsTagBO.Item> goodsSubsidiaryItemList = goodsSubsidiaryGroupBO.getList().stream().map(subsidiaryGroupDetailBO -> {
                ActivityGoodsTagBO.Item item = new ActivityGoodsTagBO.Item();
                item.setDesc(subsidiaryGroupDetailBO.getProductName());
                item.setNum(subsidiaryGroupDetailBO.getNum());
                return item;
            }).collect(Collectors.toList());

            preferentialLadder.setItems(goodsSubsidiaryItemList);
            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> giveFullMoneyCouponLadderTag(List<ActivityGoodsCouponGroupBO> goodsCouponGroupRespList) {
        return goodsCouponGroupRespList.stream().map(goodsSubsidiaryGroupBO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(goodsSubsidiaryGroupBO.getLimitValue());

            List<ActivityGoodsTagBO.Item> goodsSubsidiaryItemList = goodsSubsidiaryGroupBO.getList().stream().map(subsidiaryGroupDetailBO -> {
                ActivityGoodsTagBO.Item item = new ActivityGoodsTagBO.Item();
                item.setDesc(subsidiaryGroupDetailBO.getCouponName());
                item.setNum(subsidiaryGroupDetailBO.getNum());
                return item;
            }).collect(Collectors.toList());

            preferentialLadder.setItems(goodsSubsidiaryItemList);
            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> giveBuyGoodsGoodsLadderTag(List<ActivityGoodsSubsidiaryGroupBO> goodsSubsidiaryGroupRespList) {
        return goodsSubsidiaryGroupRespList.stream().map(goodsSubsidiaryGroupBO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(goodsSubsidiaryGroupBO.getLimitValue());

            List<ActivityGoodsTagBO.Item> goodsSubsidiaryItemList = goodsSubsidiaryGroupBO.getList().stream().map(subsidiaryGroupDetailBO -> {
                ActivityGoodsTagBO.Item item = new ActivityGoodsTagBO.Item();
                item.setDesc(subsidiaryGroupDetailBO.getProductName());
                item.setNum(subsidiaryGroupDetailBO.getNum());
                return item;
            }).collect(Collectors.toList());

            preferentialLadder.setItems(goodsSubsidiaryItemList);
            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    private List<ActivityGoodsTagBO.PreferentialLadder> giveBuyGoodsCouponLadderTag(List<ActivityGoodsCouponGroupBO> goodsCouponGroupRespList) {
        return goodsCouponGroupRespList.stream().map(goodsSubsidiaryGroupBO -> {
            ActivityGoodsTagBO.PreferentialLadder preferentialLadder = new ActivityGoodsTagBO.PreferentialLadder();
            preferentialLadder.setLimit(goodsSubsidiaryGroupBO.getLimitValue());

            List<ActivityGoodsTagBO.Item> goodsSubsidiaryItemList = goodsSubsidiaryGroupBO.getList().stream().map(subsidiaryGroupDetailBO -> {
                ActivityGoodsTagBO.Item item = new ActivityGoodsTagBO.Item();
                item.setDesc(subsidiaryGroupDetailBO.getCouponName());
                item.setNum(subsidiaryGroupDetailBO.getNum());
                return item;
            }).collect(Collectors.toList());

            preferentialLadder.setItems(goodsSubsidiaryItemList);
            return preferentialLadder;
        }).collect(Collectors.toList());
    }

    // ========================活动描述========================

    /**
     * 特价
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO specialOfferDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription(ActivityStrPoolEnum.specialOffer_desc.getMessage());

        return activityTagBO;
    }

    /**
     * 直降
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO plummetDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription(ActivityStrPoolEnum.plummet_desc.getMessage());

        return activityTagBO;
    }

    /**
     * 折扣
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO discountDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription(ActivityStrPoolEnum.discount_desc.getMessage());

        return activityTagBO;
    }

    /**
     * 满量
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO fullQuantityDesc(ActivityBO activityBO) {
        FullQuantityBO fullQuantityBO = (FullQuantityBO) activityBO.getActivityDefined();

        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());

        if (FullQuantityTypeEnum.REDUCTION.getCode().equals(fullQuantityBO.getType())) {
            List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullQuantityReductionLadderTag(fullQuantityBO);
            activityTagBO.setActivityDescription(this.preferentialLadderToString(fullQuantityBO, preferentialLadders));
        } else if (FullQuantityTypeEnum.DISCOUNT.getCode().equals(fullQuantityBO.getType())) {
            List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullQuantityDiscountLadderTag(fullQuantityBO);
            activityTagBO.setActivityDescription(this.preferentialLadderToString(fullQuantityBO, preferentialLadders));
        }

        return activityTagBO;
    }

    /**
     * 满额
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO fullMoneyDesc(ActivityBO activityBO) {
        FullMoneyBO fullMoneyBO = (FullMoneyBO) activityBO.getActivityDefined();

        Integer belongType = activityBO.getBelongType();

        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());

        if (BelongTypeEnum.PLATFORM.getCode().equals(belongType)) {
            if (FullMoneyTypeEnum.REDUCTION.getCode().equals(fullMoneyBO.getType())) {
                List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullMoneyReductionLadderTag(fullMoneyBO);
                activityTagBO.setActivityDescription(ActivityStrPoolEnum.full_money_pt_reduction_at.getMessage() + ActivityStrPoolEnum.comma_zh.getMessage() + this.preferentialLadderToString(fullMoneyBO, preferentialLadders));

            } else if (FullMoneyTypeEnum.DISCOUNT.getCode().equals(fullMoneyBO.getType())) {
                List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullMoneyDiscountLadderTag(fullMoneyBO);
                activityTagBO.setActivityDescription(ActivityStrPoolEnum.full_money_pt_discount_at.getMessage() + ActivityStrPoolEnum.comma_zh.getMessage() + this.preferentialLadderToString(fullMoneyBO, preferentialLadders));
            }

        } else if (BelongTypeEnum.MERCHANT.getCode().equals(belongType)) {
            if (FullMoneyTypeEnum.REDUCTION.getCode().equals(fullMoneyBO.getType())) {
                List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullMoneyReductionLadderTag(fullMoneyBO);
                activityTagBO.setActivityDescription(this.preferentialLadderToString(fullMoneyBO, preferentialLadders));

            } else if (FullMoneyTypeEnum.DISCOUNT.getCode().equals(fullMoneyBO.getType())) {
                List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.fullMoneyDiscountLadderTag(fullMoneyBO);
                activityTagBO.setActivityDescription(this.preferentialLadderToString(fullMoneyBO, preferentialLadders));
            }
        }

        return activityTagBO;
    }

    /**
     * 赠送
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO giveDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription("");
        return activityTagBO;
    }

    /**
     * 多件
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO morePieceDesc(ActivityBO activityBO) {
        MorePieceBO morePieceBO = (MorePieceBO) activityBO.getActivityDefined();

        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());

        List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadders = this.morePieceLadderTag(morePieceBO);
        activityTagBO.setActivityDescription(this.preferentialLadderToString(morePieceBO, preferentialLadders));

        return activityTagBO;
    }

    /**
     * 组合
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO combinationDesc(ActivityBO activityBO) {
        CombinationBO combinationBO = (CombinationBO) activityBO.getActivityDefined();

        String desc = strFormat(ActivityStrPoolEnum.combination_ptd.getMessage(), decimalFormatStr(combinationBO.getPrice()), combinationBO.getNum());

        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription(desc);

        return activityTagBO;
    }

    /**
     * 拼团
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO groupPurchaseDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription("");
        return activityTagBO;
    }

    /**
     * 砍价
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO bargainDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription("");
        return activityTagBO;
    }

    /**
     * 秒杀
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO secKillDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription("");
        return activityTagBO;
    }

    /**
     * 换购
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO swapDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription("");
        return activityTagBO;
    }

    /**
     * 预售
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO preSaleDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription("");
        return activityTagBO;
    }

    /**
     * 套餐
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO setMealDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription("");
        return activityTagBO;
    }

    /**
     * 试用
     * @param activityBO 活动
     * @return 返回结果
     */
    private ActivityTagBO attemptDesc(ActivityBO activityBO) {
        ActivityTagBO activityTagBO = new ActivityTagBO();
        activityTagBO.setActivityId(activityBO.getActivityId());
        activityTagBO.setBelongType(activityBO.getBelongType());
        activityTagBO.setActivityType(activityBO.getActivityType());
        activityTagBO.setActivityName(activityBO.getActivityName());
        activityTagBO.setStartTime(activityBO.getStartTime());
        activityTagBO.setEndTime(activityBO.getEndTime());
        activityTagBO.setActivityDescription("");
        return activityTagBO;
    }

    /**
     * 优惠梯度标签转换
     * @param activityDefinedBO 活动定义
     * @param preferentialLadderList 优惠梯度
     * @return 返回结果
     */
    private String preferentialLadderToString(ActivityDefinedBO activityDefinedBO, List<ActivityGoodsTagBO.PreferentialLadder> preferentialLadderList) {
        Integer activityType = activityDefinedBO.getActivityType();
        if (ActivityTypeEnum.FULL_QUANTITY.getCode().equals(activityType)) {
            // 满量促销
            return preferentialLadderList.stream()
                    .sorted(Comparator.comparing(ActivityGoodsTagBO.PreferentialLadder::getLimit))
                    .map(ActivityGoodsTagBO.PreferentialLadder::getDesc)
                    .collect(Collectors.joining(semicolon_zh));
        } else if (ActivityTypeEnum.FULL_MONEY.getCode().equals(activityType)) {
            // 满额促销
            return preferentialLadderList.stream()
                    .sorted(Comparator.comparing(ActivityGoodsTagBO.PreferentialLadder::getLimit))
                    .map(ActivityGoodsTagBO.PreferentialLadder::getDesc)
                    .collect(Collectors.joining(ActivityStrPoolEnum.semicolon_zh.getMessage()));
        } else if (ActivityTypeEnum.GIVE.getCode().equals(activityType)) {
            // 赠送
            GiveBO giveBO = (GiveBO) activityDefinedBO;
            String descTempOne = "";
            String descTempTwo = "";

            if (GiveTypeEnum.FULL_MONEY.getCode().equals(giveBO.getGiveType())) {
                if (GiveGiftTypeEnum.GOODS.getCode().equals(giveBO.getGiftType())) {
                    descTempOne = ActivityStrPoolEnum.give_goods_ptd_full_money_1.getMessage();
                    descTempTwo = ActivityStrPoolEnum.give_goods_ptd_full_money_2.getMessage();
                } else if (GiveGiftTypeEnum.COUPON.getCode().equals(giveBO.getGiftType())) {
                    descTempOne = ActivityStrPoolEnum.give_coupon_ptd_full_money_1.getMessage();
                    descTempTwo = ActivityStrPoolEnum.give_coupon_ptd_full_money_2.getMessage();
                }
            } else if (GiveTypeEnum.BUY_GOODS.getCode().equals(giveBO.getGiveType())) {
                if (GiveGiftTypeEnum.GOODS.getCode().equals(giveBO.getGiftType())) {
                    descTempOne = ActivityStrPoolEnum.give_goods_ptd_buy_goods_1.getMessage();
                    descTempTwo = ActivityStrPoolEnum.give_goods_ptd_buy_goods_2.getMessage();
                } else if (GiveGiftTypeEnum.COUPON.getCode().equals(giveBO.getGiftType())) {
                    descTempOne = ActivityStrPoolEnum.give_coupon_ptd_buy_goods_1.getMessage();
                    descTempTwo = ActivityStrPoolEnum.give_coupon_ptd_buy_goods_2.getMessage();
                }
            }

            StringBuilder stringBuilder = new StringBuilder();
            for (ActivityGoodsTagBO.PreferentialLadder preferentialLadder : preferentialLadderList) {
                stringBuilder.append(strFormat(descTempOne, decimalFormatStr(preferentialLadder.getLimit())));

                List<ActivityGoodsTagBO.Item> items = preferentialLadder.getItems();

                for (ActivityGoodsTagBO.Item item : items) {
                    stringBuilder.append(strFormat(descTempTwo, item.getDesc(), item.getNum()));
                    stringBuilder.append(ActivityStrPoolEnum.comma_zh.getMessage());
                }

                if (!CollectionUtils.isEmpty(items)) {
                    // 删除最后一个字符
                    stringBuilder.deleteCharAt(stringBuilder.length() - 1);

                }
                stringBuilder.append(ActivityStrPoolEnum.semicolon_zh.getMessage());
            }

            if (!CollectionUtils.isEmpty(preferentialLadderList)) {
                // 删除最后一个字符
                stringBuilder.deleteCharAt(stringBuilder.length() - 1);

            }

            return stringBuilder.toString();

        } else if (ActivityTypeEnum.MORE_PIECE.getCode().equals(activityType)) {
            return preferentialLadderList.stream()
                    .sorted(Comparator.comparing(ActivityGoodsTagBO.PreferentialLadder::getLimit))
                    .map(ActivityGoodsTagBO.PreferentialLadder::getDesc)
                    .collect(Collectors.joining(ActivityStrPoolEnum.semicolon_zh.getMessage()));
        } else if (ActivityTypeEnum.SWAP.getCode().equals(activityType)) {
            StringBuilder stringBuilder = new StringBuilder();
            for (ActivityGoodsTagBO.PreferentialLadder preferentialLadder : preferentialLadderList) {
                List<ActivityGoodsTagBO.Item> items = preferentialLadder.getItems();
                for (ActivityGoodsTagBO.Item item : items) {
                    stringBuilder.append(item.getDesc());
                    stringBuilder.append(ActivityStrPoolEnum.comma_zh.getMessage());
                }

                if (!CollectionUtils.isEmpty(items)) {
                    // 删除最后一个字符
                    stringBuilder.deleteCharAt(stringBuilder.length() - 1);

                }

                stringBuilder.append(ActivityStrPoolEnum.semicolon_zh.getMessage());
            }

            if (!CollectionUtils.isEmpty(preferentialLadderList)) {
                // 删除最后一个字符
                stringBuilder.deleteCharAt(stringBuilder.length() - 1);
            }

            return stringBuilder.toString();
        }

        return "";
    }
}
